# sprite = codesters.Rectangle(x, y, width, height, "color")
start = codesters.Rectangle(0, -250, 500, 50, "red")
# sprite = codesters.Rectangle(x, y, width, height, "color")
finish = codesters.Rectangle(0, 250, 500, 50, "green")
my_list = [-150, -50, 50, 150]
for value in my_list:
pass # delete after adding indented code
# add code here
# sprite = codesters.Rectangle(x, y, width, height, "color")
sprite = codesters.Rectangle(0, value, 500, 50, "gray")
# sprite = codesters.Sprite("image", x, y)
sprite = codesters.Sprite("turtle1", 0, -240)
sprite.set_size(.2)
sprite.turn_left(90)
def interval():
sprite.turn_left(15)
# add any other actions...
stage.event_interval(interval, 0.5)
t = codesters.Teacher()
turn_lefts = t.find_function("turn_left")
rand_choices = t.find_text("random.choice")
tval1 = len(turn_lefts)
try:
tval2 = rand_choices[0][1].lower().replace(' ','')
tval2_indent = t.get_indent_at_line(rand_choices[0][0])
except:
tval2 = "DNE"
tval2_indent = "DNE"
t1 = TestObjective()
t1.add_success(tval1 == 1, "Great Job!")
t1.add_failure(tval1 > 1, "Did you delete the sprite.turn_left(15) from inside the interval event?")
t2 = TestObjective()
t2.add_success(tval2 != "DNE" and tval2_indent == 4, "Great job!")
t2.add_failure(tval2 == "DNE", "Did you add Random Choice inside the interval event?")
t2.add_failure(tval2 != "DNE" and tval2_indent != 4, "Make sure Random Choice is indented once inside the event!")
tester = TestManager()
tester.add_test_list([t1, t2])
tester.run_tests()
tester.display_first_feedback()
-
Run Code
-
Activity Submitted!
Submit Work
-
Next Activity
-
Stop Running Code
-
Show Chart
-
Show Console
-
Reset Code Editor
-
Codesters How To (opens in a new tab)